//
//  HomeViewController.m
//  myWebrtc
//
//  Created by shaMo on 2020/2/18.
//  Copyright © 2020 shaMo. All rights reserved.
//

#import "HomeViewController.h"
#import "ChatVieViewController.h"
#import "KLSdk.h"

@interface HomeViewController ()

@property (weak, nonatomic) IBOutlet UITextField *roomTF;
@property (weak, nonatomic) IBOutlet UIButton *joinButton;

@end

@implementation HomeViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"加入会议";
    self.joinButton.layer.borderColor = UIColor.lightGrayColor.CGColor;
    self.joinButton.layer.borderWidth = 1.0;
}


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:45/255.f green:45/255.f blue:57/255.f alpha:1.0];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor],
                                                                      NSFontAttributeName : [UIFont fontWithName:@"Helvetica-Bold" size:17]}];
    
}

- (IBAction)joinRoom:(UIButton *)sender
{
    if (self.roomTF.text.length == 0) {
        return;
    }
    [[KLSdk shared] joinMeetingWithRoomId:self.roomTF.text];
    ChatVieViewController *chatVc = [ChatVieViewController new];
    chatVc.roomId = self.roomTF.text;
    chatVc.modalPresentationStyle = UIModalPresentationOverFullScreen;
    [self presentViewController:chatVc animated:YES completion:nil];
}


@end
